<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <title>首页 - Blog</title>
    <link rel="stylesheet" href="./static/layui/css/layui.css">
    <link rel="stylesheet" href="./static/css/common.css">
</head>
<body>
<header class="layui-bg-cyan">
    <nav class="layui-container">
        <div class="layui-row">
            <div class="layui-col-md2 logo">
                <a href="javascript:;"><img src="./static/images/logo.png"></a>
            </div>
            <div class="layui-col-md8 layui-hide-xs">
                <ul class="layui-nav layui-bg-cyan">
                    <li class="layui-nav-item layui-this">
                        <a href="index.html" name="首页">首页</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="caty.html?type=javabase" name="Java基础">JAVA基础</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="caty.html?type=db" name="数据库">数据库</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="caty.html?type=jsp" name="JSP">JSP</a>
                    </li>
                    <li class="layui-nav-item">
                        <a href="caty.html?type=framework" name="框架">框架</a>
                    </li>
                </ul>
            </div>
            <div class="layui-col-md2 layui-hide-xs userinfoBox">
                <ul class="layui-nav layui-bg-cyan">
                    <li class="layui-nav-item" lay-unselect="">
                        <span><img src="static/images/user01.png" class="layui-nav-img"></span>
                        <span title="name2"></span>
                        <dl class="layui-nav-child">
                            <dd><a href="login.html">登录</a></dd>
                            <dd><a href="main.html">后台管理</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
</header>
<div class="layui-container">
    <div class="layui-row layui-col-space20">
        <div class="layui-col-md8">
            <div class="layui-row">
                <div class="layui-col-md12">
                    <div class="layui-carousel" id="carousel">
                        <div carousel-item>
                            <div><img src="static/images/carousel -1.jpg" alt=""></div>
                            <div><img src="static/images/carousel -2.jpg" alt=""></div>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md12 margin20"></div>
                <div class="layui-col-md12">
                    <div class="main zdbox">

                    </div>
                </div>


                <div class="layui-col-md12 margin20"></div>


                <div id="layui" name="显示全部"></div>


                <div class="layui-col-md12" id="pages"></div>
            </div>
        </div>
        <div class="layui-col-md4">
            <div class="layui-row">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">
								<span class="layui-breadcrumb" lay-separator="|">
									<a href="javascript:void(0);">联系站长李坤</a>
								</span>
                        </div>
                        <div class="layui-card-body" id="binfo">
                            <table class="layui-table">
                                <colgroup>
                                    <col width="120">
                                    <col width="230">
                                </colgroup>
                                <tbody>
                                <tr>
                                    <td>QQ号：</td>
                                    <td>1273703401</td>
                                </tr>
                                <tr>
                                    <td>微信号：</td>
                                    <td>l1273703401</td>
                                </tr>
                                <tr>
                                    <td>qq群号：</td>
                                    <td>305648634</td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md12 margin20"></div>
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">
								<span>
									热门文章
								</span>
                        </div>
                        <div class="layui-card-body">
                            <table class="layui-table" lay-skin="nob">
                                <tbody id="findBlogTextByClickNumber">

                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md12 margin20"></div>
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-header">
								<span>
									捐助本站
								</span>
                        </div>
                        <div class="layui-card-body" style="text-align: center;">
                            <input type="image" src="static/images/qr.png" style="display: inline-block;" title="多给点钱">
                            <!--<img src="static/images/qr.png" style="display: inline-block;">-->
                            <br/>
                            <p>无论多少，都是心意!</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 尾部 -->
<div class="footer"></div>
<footer class="layui-bg-cyan">
    <div class="layui-container">
        <div class="layui-row">
        </div>
    </div>
</footer>
</body>
<script src="./static/layui/layui.all.js"></script>
<script type="text/javascript" src="./static/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
    /* 查看全部博客*/
    $(document).ready(function () {
        $.get("Blog/showAll", {"page": 1}, function (rs) {
            $("[class=\"layui-col-md12]").empty();
            for (var i = 0; i < rs.length; i++) {
                $("<div class=\"layui-col-md12\">\n" +
                    "<div class=\"main list\">\n" +
                    "<div class=\"subject\"><a title='中括号' name='" + rs[i].type + "'class=\"caty\">[" + rs[i].type + "]</a><a name='" + rs[i].blogid + "' " +
                    "title=\"用SSM框架制作一个博客网站（响应式模板）\">" + rs[i].title + "</a><em>&nbsp&nbsp&nbsp发布日期：" + rs[i].posttime +
                    "</em></div>\n" +
                    "<div class=\"content layui-row\">\n" +
                    "<div class=\"layui-col-md4 list-img\">\n" +
                    "<a href=\"javascript:;\"><img src=\"./static/images/list_img.png\"></a>\n" +
                    "</div>\n" +
                    "<div class=\"layui-col-md8\">\n" +
                    "<div class=\"list-text\">" + rs[i].detail.substring(0, 50) + "\n" +
                    "</div>\n" +
                    "<div class=\"list-stat layui-row\">\n" +
                    "\n" +
                    "<div class=\"layui-col-xs3 layui-col-md3 Label\">\n" +
                    "<i class=\"layui-icon layui-icon-note\"></i>\n" +
                    "<a href=\"caty.html?type=javabase\">" + rs[i].type + "</a>\n" +
                    "\n" +
                    "</div>\n" +
                    "<div class=\"layui-col-xs3 layui-col-md3\">\n" +
                    "<i class=\"layui-icon layui-icon-read\"></i>\n" +
                    "<em>" + rs[i].clicknumber + "</em>\n" +
                    "</div>\n" +
                    "\n" +
                    "<div class=\"layui-col-xs3 layui-col-md3 alink\">\n" +
                    "<a class='layui-btn layui-btn-xs' title='阅读原文' name='" + rs[i].blogid + "'>阅读原文</a>\n" +
                    "</div>\n" +
                    "</div>\n" +
                    "</div>\n" +
                    "</div>\n" +
                    "</div>\n" +
                    "</div>" +
                    "<div class=\"layui-col-md12 margin20\"></div>").appendTo("div[name='显示全部']");
            }
        });

        /*通过类型分类跳转的类似条件查询*/
        $("a[name='Java基础']").click(function () {
            var java = $(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type", java);
            window.location.href = "http://localhost:8080/caty.html";
        });
        $("a[name='数据库']").click(function () {
            var database = $(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type", database);
            window.location.href = "http://localhost:8080/caty.html";

        });
        $("a[name='JSP']").click(function () {
            var jsp = $(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type", jsp);
            window.location.href = "http://localhost:8080/caty.html";
        });
        $("a[name='框架']").click(function () {
            var jsp = $(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type", jsp);
            window.location.href = "http://localhost:8080/caty.html";
        });
    });
</script>
<script type="text/javascript">
    /*博客详情*/
    $(document).ready(function () {
        /*置顶详情*/
        $(document).on("click", "a[title='置顶详情']", function () {
            sessionStorage.clear();
            var blogid = $(this).attr("name");
            sessionStorage.setItem("blogid", blogid);
            $.get("Blog/updateClickNumber", {"blogid": blogid}, function () {
            });
            window.location.href = "http://localhost:8080/detail.html";
        });

        /*阅读原文详情*/
        $(document).on("click", "a[title='阅读原文']", function () {
            sessionStorage.clear();
            var blogid = $(this).attr("name");
            sessionStorage.setItem("blogid", blogid);
            $.get("Blog/updateClickNumber", {"blogid": blogid}, function () {
            });
            window.location.href = "http://localhost:8080/detail.html";
        });

        /*热门推荐详情*/
        $(document).on("click", "a[title='热门榜']", function () {
            sessionStorage.clear();
            var blogid = $(this).attr("name");
            sessionStorage.setItem("blogid", blogid);
            $.get("Blog/updateClickNumber", {"blogid": blogid}, function () {
            });
            window.location.href = "http://localhost:8080/detail.html";
        });

        $(document).on("click", "a[title='中括号']", function () {
            var java = $(this).attr("name");
            sessionStorage.clear();
            sessionStorage.setItem("type", java);
            window.location.href = "http://localhost:8080/caty.html";
        });

        $(document).on("click", "a[title=\"用SSM框架制作一个博客网站（响应式模板）\"]", function () {
            sessionStorage.clear();
            var blogid = $(this).attr("name");
            sessionStorage.setItem("blogid", blogid);
            $.get("Blog/updateClickNumber", {"blogid": blogid}, function () {
            });
            window.location.href = "http://localhost:8080/detail.html";
        });
    });
</script>
<script type="text/javascript">
    /* 热门文章的信息*/
    $(document).ready(function () {
        $.get("Blog/findBlogTextByClickNumber", function (rs) {
            JSON.stringify(rs)
            $("tbody[id=\"findBlogTextByClickNumber\"]").empty();
            var wos = rs.result;
            sessionStorage.setItem("wos", wos)
            for (var i = 0; i < wos.length; i++) {
                $("<tr>\n" +
                    "<td><a  title='热门榜' name='" + wos[i].blogid + "'>" + wos[i].title + "</a></td>" +
                    "</tr>").appendTo("tbody[id=\"findBlogTextByClickNumber\"]");
            }
            $("input[type='image']").click(function () {
                alert("你已经捐款1000万");
            })
        });
    });
</script>
<script type="text/javascript">
    /*置顶信息查询*/
    $(document).ready(function () {
        $.get("/Top/showTop", function (topData) {
            /*var topDataList = topData.result;*/
            $("div[class='main zdbox']").empty();
            for (var i = 0; i < topData.length; i++) {
                if (topData[i].status == 1) {
                    $("<div class=subject><b>[置顶]</b><a title='置顶详情' name='" + topData[i].blogid + "'>" + topData[i].title + "</a><em>" + topData[i].posttime +
                        "发布</em><div class='content'>" + topData[i].detail.substring(0, 50) + " </div></div>").appendTo("div[class='main zdbox']")
                    $(".layui-bg-cyan")
                }
            }
        });
    })
</script>
<script type="text/javascript">
    $(document).ready(function () {
        if (localStorage.getItem("username1") == null) {
            $("<tr><td>游客</td></tr>").appendTo("span[title='name2']")
        }else {
            var name1 = localStorage.getItem("username1");
            $("<tr><td>" + name1 + "</td></tr>").appendTo("span[title='name2']")
        }
    });
</script>
<script>
    $(document).ready(function () {
        $.get("Blog/count", function (count) {
            s = count;
            layui.laypage.render({
                elem: 'pages', //注意，这里的 pages 是 ID，不用加 # 号
                count: s, //数据总数，从服务端得到
                limit: 5,   //每页条数设置
                jump: function (obj, first) {
                    //obj包含了当前分页的所有参数，比如：
                    page = obj.curr;  //改变当前页码
                    limit = obj.limit;
                    //首次不执行
                    if (!first) {
                        var page = obj.curr;
                        $.get("Blog/showAll", {"page": page}, function (rs) {
                            $("div[name='显示全部']").empty();
                            for (var i = 0; i < rs.length; i++) {
                                $("<div class=\"layui-col-md12\">\n" +
                                    "<div class=\"main list\">\n" +
                                    "<div class=\"subject\"><a title='中括号' name='" + rs[i].type + "'class=\"caty\">[" + rs[i].type + "]</a><a name='" + rs[i].blogid + "' " +
                                    "title=\"用SSM框架制作一个博客网站（响应式模板）\">" + rs[i].title + "</a><em>" +
                                    "" + rs[i].posttime + "</em></div>\n" +
                                    "<div class=\"content layui-row\">\n" +
                                    "<div class=\"layui-col-md4 list-img\">\n" +
                                    "<a href=\"javascript:;\"><img src=\"./static/images/list_img.png\"></a>\n" +
                                    "</div>\n" +
                                    "<div class=\"layui-col-md8\">\n" +
                                    "<div class=\"list-text\">" + rs[i].detail.substring(0, 50) + "\n" +
                                    "</div>\n" +
                                    "<div class=\"list-stat layui-row\">\n" +
                                    "\n" +
                                    "<div class=\"layui-col-xs3 layui-col-md3 Label\">\n" +
                                    "<i class=\"layui-icon layui-icon-note\"></i>\n" +
                                    "<a href=\"caty.html?type=javabase\">" + rs[i].type + "</a>\n" +
                                    "\n" +
                                    "</div>\n" +
                                    "<div class=\"layui-col-xs3 layui-col-md3\">\n" +
                                    "<i class=\"layui-icon layui-icon-read\"></i>\n" +
                                    "<em>" + rs[i].clicknumber + "</em>\n" +
                                    "</div>\n" +
                                    "\n" +
                                    "<div class=\"layui-col-xs3 layui-col-md3 alink\">\n" +
                                    "<a class='layui-btn layui-btn-xs' title='阅读原文' name='" + rs[i].blogid + "'>阅读原文</a>\n" +
                                    "</div>\n" +
                                    "</div>\n" +
                                    "</div>\n" +
                                    "</div>\n" +
                                    "</div>\n" +
                                    "</div>" +
                                    "<div class=\"layui-col-md12 margin20\"></div>").appendTo("div[name='显示全部']");
                            }
                        });
                    }
                }
            });
        });
    })
</script>
</html>